package com.mspbots.rule.queue.attendance;

import com.mspbots.cw.request.TenantUserConfigurationDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author Dinnes
 */
@Slf4j
@Component
public class NotEodTooLongQueue extends AttendanceBaseQueue {
    private static final String START_RULE_NAME = "NotEodTooLong";

    @RabbitListener(queues = "trigger.attendance.NotEodTooLong")
    public void onQueue(List<TenantUserConfigurationDTO> tenantUserConfigurationDTOList) {
        tenantUserConfigurationDTOList
                .parallelStream()
                .forEach(
                        tenantUserConfigurationDTO -> super.onRule(START_RULE_NAME, tenantUserConfigurationDTO)
                );
    }
}
